public abstract class Storage {
	protected final int limit;
	protected int count;
	protected int getCount;
	protected int putCount;
	protected int putterCount = 0;
	
	protected Storage(int limit, int getCount, int putCount) {
		this.limit = limit;
		this.count = 0;
		this.getCount = getCount;
		this.putCount = putCount;
	}
	
	public synchronized boolean put() {
		if(count + putCount <= limit) {
			count += putCount;
			return true;
		}
		return false;
	}

	public synchronized boolean get() {
		if (count >= getCount) {
			count -= getCount ;
			return true;
		}
		return false;
	}
	
	
	public synchronized void assignPutter() {
		this.putterCount++;
	}
	
	public synchronized void removePutter() {
		this.putterCount--;
	}
	
	public synchronized boolean checkPuttersDone() {
		return (this.putterCount == 0);
	}
	
	public synchronized boolean isEmpty() {
		return (this.count == 0);
	}

}
